<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.10.0"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>common_util: cutl::datetime Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<script type="text/javascript" src="clipboard.js"></script>
<script type="text/javascript" src="cookie.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectalign">
   <div id="projectname">common_util
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.10.0 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search/",'.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><b>cutl</b></li><li class="navelem"><a class="el" href="classcutl_1_1datetime.html">datetime</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pub-static-methods">Static Public Member Functions</a> &#124;
<a href="#pub-static-attribs">Static Public Attributes</a> &#124;
<a href="classcutl_1_1datetime-members.html">List of all members</a>  </div>
  <div class="headertitle"><div class="title">cutl::datetime Class Reference</div></div>
</div><!--header-->
<div class="contents">

<p>A simple, feature-rich modern C++ date-time class.  
 <a href="#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="datetime_8h_source.html">datetime.h</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pub-methods" name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:ac6a75875790295481a05a136af4a2439" id="r_ac6a75875790295481a05a136af4a2439"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#ac6a75875790295481a05a136af4a2439">datetime</a> (uint64_t <a class="el" href="timeutil_8h.html#a5123cf2b94c1fabe15fb9ba61231d5f1aee33e909372d935d190f4fcb2a92d542">ms</a>)</td></tr>
<tr class="memdesc:ac6a75875790295481a05a136af4a2439"><td class="mdescLeft">&#160;</td><td class="mdescRight">Construct a new datetime object.  <br /></td></tr>
<tr class="separator:ac6a75875790295481a05a136af4a2439"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9d1d9cc43a398a20909754ffa3de7366" id="r_a9d1d9cc43a398a20909754ffa3de7366"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a9d1d9cc43a398a20909754ffa3de7366">datetime</a> (const <a class="el" href="classcutl_1_1datetime.html">datetime</a> &amp;other)</td></tr>
<tr class="memdesc:a9d1d9cc43a398a20909754ffa3de7366"><td class="mdescLeft">&#160;</td><td class="mdescRight">Construct a new datetime object.  <br /></td></tr>
<tr class="separator:a9d1d9cc43a398a20909754ffa3de7366"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5878a7ef4a103f0146647923d1567beb" id="r_a5878a7ef4a103f0146647923d1567beb"><td class="memItemLeft" align="right" valign="top"><a id="a5878a7ef4a103f0146647923d1567beb" name="a5878a7ef4a103f0146647923d1567beb"></a>
&#160;</td><td class="memItemRight" valign="bottom"><b>~datetime</b> ()</td></tr>
<tr class="memdesc:a5878a7ef4a103f0146647923d1567beb"><td class="mdescLeft">&#160;</td><td class="mdescRight">Destroy the datetime object. <br /></td></tr>
<tr class="separator:a5878a7ef4a103f0146647923d1567beb"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a51fa427db5c0c7da4b4af906a958fdf2" id="r_a51fa427db5c0c7da4b4af906a958fdf2"><td class="memItemLeft" align="right" valign="top">uint64_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a51fa427db5c0c7da4b4af906a958fdf2">timestamp</a> () const</td></tr>
<tr class="memdesc:a51fa427db5c0c7da4b4af906a958fdf2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the timestamp in milliseconds.  <br /></td></tr>
<tr class="separator:a51fa427db5c0c7da4b4af906a958fdf2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3b652358d578694167f43d3dfe304e57" id="r_a3b652358d578694167f43d3dfe304e57"><td class="memItemLeft" align="right" valign="top">std::string&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a3b652358d578694167f43d3dfe304e57">format</a> (<a class="el" href="datetime_8h.html#a4e11bf4fcf504b16f185690443d143b4">datetime_format</a> dfmt=<a class="el" href="datetime_8h.html#a4e11bf4fcf504b16f185690443d143b4afc53fb608f9400b917e42c8c643be5a2">datetime_format::datetime_format_a</a>, bool local=true, bool show_milliseconds=true) const</td></tr>
<tr class="memdesc:a3b652358d578694167f43d3dfe304e57"><td class="mdescLeft">&#160;</td><td class="mdescRight">format the datetime object to a string  <br /></td></tr>
<tr class="separator:a3b652358d578694167f43d3dfe304e57"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1cc0a22792d1523874a647a3e336229f" id="r_a1cc0a22792d1523874a647a3e336229f"><td class="memItemLeft" align="right" valign="top">std::string&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a1cc0a22792d1523874a647a3e336229f">format</a> (const std::string &amp;fmt, bool local=true, bool show_milliseconds=true) const</td></tr>
<tr class="memdesc:a1cc0a22792d1523874a647a3e336229f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Format the datetime object to a string with a custom format string.  <br /></td></tr>
<tr class="separator:a1cc0a22792d1523874a647a3e336229f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3a0d03eb44d72d49e727d8bf6c6c6517" id="r_a3a0d03eb44d72d49e727d8bf6c6c6517"><td class="memItemLeft" align="right" valign="top">std::string&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a3a0d03eb44d72d49e727d8bf6c6c6517">utctime</a> () const</td></tr>
<tr class="memdesc:a3a0d03eb44d72d49e727d8bf6c6c6517"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the string of UTC time described by datetime object.  <br /></td></tr>
<tr class="separator:a3a0d03eb44d72d49e727d8bf6c6c6517"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a894c09f6eb005ed597a1de2392cbf737" id="r_a894c09f6eb005ed597a1de2392cbf737"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classcutl_1_1datetime.html">datetime</a> &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a894c09f6eb005ed597a1de2392cbf737">operator=</a> (const <a class="el" href="classcutl_1_1datetime.html">datetime</a> &amp;other)</td></tr>
<tr class="memdesc:a894c09f6eb005ed597a1de2392cbf737"><td class="mdescLeft">&#160;</td><td class="mdescRight">Define the assignment operator.  <br /></td></tr>
<tr class="separator:a894c09f6eb005ed597a1de2392cbf737"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a75282bebb7e0f1a9f359d8fc3cc98a3b" id="r_a75282bebb7e0f1a9f359d8fc3cc98a3b"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classcutl_1_1datetime.html">datetime</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a75282bebb7e0f1a9f359d8fc3cc98a3b">operator+</a> (uint64_t <a class="el" href="timeutil_8h.html#a5123cf2b94c1fabe15fb9ba61231d5f1aee33e909372d935d190f4fcb2a92d542">ms</a>)</td></tr>
<tr class="memdesc:a75282bebb7e0f1a9f359d8fc3cc98a3b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Define the addition operator.  <br /></td></tr>
<tr class="separator:a75282bebb7e0f1a9f359d8fc3cc98a3b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab4eb96ab29e504b7b9037338d2f9d0be" id="r_ab4eb96ab29e504b7b9037338d2f9d0be"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classcutl_1_1datetime.html">datetime</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#ab4eb96ab29e504b7b9037338d2f9d0be">operator-</a> (uint64_t <a class="el" href="timeutil_8h.html#a5123cf2b94c1fabe15fb9ba61231d5f1aee33e909372d935d190f4fcb2a92d542">ms</a>)</td></tr>
<tr class="memdesc:ab4eb96ab29e504b7b9037338d2f9d0be"><td class="mdescLeft">&#160;</td><td class="mdescRight">Define the subtraction operator.  <br /></td></tr>
<tr class="separator:ab4eb96ab29e504b7b9037338d2f9d0be"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad2fc579ef4a4b885b6c52b3bb8716022" id="r_ad2fc579ef4a4b885b6c52b3bb8716022"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classcutl_1_1datetime.html">datetime</a> &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#ad2fc579ef4a4b885b6c52b3bb8716022">operator+=</a> (uint64_t <a class="el" href="timeutil_8h.html#a5123cf2b94c1fabe15fb9ba61231d5f1aee33e909372d935d190f4fcb2a92d542">ms</a>)</td></tr>
<tr class="memdesc:ad2fc579ef4a4b885b6c52b3bb8716022"><td class="mdescLeft">&#160;</td><td class="mdescRight">Define the addition and assignment operator.  <br /></td></tr>
<tr class="separator:ad2fc579ef4a4b885b6c52b3bb8716022"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a411c0ba1168f95601b8cc2e708959f23" id="r_a411c0ba1168f95601b8cc2e708959f23"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classcutl_1_1datetime.html">datetime</a> &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a411c0ba1168f95601b8cc2e708959f23">operator-=</a> (uint64_t <a class="el" href="timeutil_8h.html#a5123cf2b94c1fabe15fb9ba61231d5f1aee33e909372d935d190f4fcb2a92d542">ms</a>)</td></tr>
<tr class="memdesc:a411c0ba1168f95601b8cc2e708959f23"><td class="mdescLeft">&#160;</td><td class="mdescRight">Define the subtraction and assignment operator.  <br /></td></tr>
<tr class="separator:a411c0ba1168f95601b8cc2e708959f23"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af2de8f10337d6750870393076d1a02d3" id="r_af2de8f10337d6750870393076d1a02d3"><td class="memItemLeft" align="right" valign="top">int64_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#af2de8f10337d6750870393076d1a02d3">operator-</a> (const <a class="el" href="classcutl_1_1datetime.html">datetime</a> &amp;other) const</td></tr>
<tr class="memdesc:af2de8f10337d6750870393076d1a02d3"><td class="mdescLeft">&#160;</td><td class="mdescRight">Define the subtraction operator between two datetime objects.  <br /></td></tr>
<tr class="separator:af2de8f10337d6750870393076d1a02d3"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pub-static-methods" name="pub-static-methods"></a>
Static Public Member Functions</h2></td></tr>
<tr class="memitem:a2f26f17577618f7133b62b0343ecca0c" id="r_a2f26f17577618f7133b62b0343ecca0c"><td class="memItemLeft" align="right" valign="top">static <a class="el" href="classcutl_1_1datetime.html">datetime</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a2f26f17577618f7133b62b0343ecca0c">now</a> ()</td></tr>
<tr class="memdesc:a2f26f17577618f7133b62b0343ecca0c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get a datetime object for the current system time.  <br /></td></tr>
<tr class="separator:a2f26f17577618f7133b62b0343ecca0c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:add0aca89e3efa88a933113e181903be9" id="r_add0aca89e3efa88a933113e181903be9"><td class="memItemLeft" align="right" valign="top">static <a class="el" href="classcutl_1_1datetime.html">datetime</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#add0aca89e3efa88a933113e181903be9">get</a> (const std::string &amp;time_text, int isdst=-1)</td></tr>
<tr class="memdesc:add0aca89e3efa88a933113e181903be9"><td class="mdescLeft">&#160;</td><td class="mdescRight">Constructs a datetime object from a local time string.  <br /></td></tr>
<tr class="separator:add0aca89e3efa88a933113e181903be9"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pub-static-attribs" name="pub-static-attribs"></a>
Static Public Attributes</h2></td></tr>
<tr class="memitem:ad4d844ed6c8d5bb3f7f332001ea17544" id="r_ad4d844ed6c8d5bb3f7f332001ea17544"><td class="memItemLeft" align="right" valign="top"><a id="ad4d844ed6c8d5bb3f7f332001ea17544" name="ad4d844ed6c8d5bb3f7f332001ea17544"></a>
static constexpr int&#160;</td><td class="memItemRight" valign="bottom"><b>second</b> = 1000</td></tr>
<tr class="memdesc:ad4d844ed6c8d5bb3f7f332001ea17544"><td class="mdescLeft">&#160;</td><td class="mdescRight">Constants value: second, expressed in milliseconds. <br /></td></tr>
<tr class="separator:ad4d844ed6c8d5bb3f7f332001ea17544"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2715f00996ee150322771d662f4513de" id="r_a2715f00996ee150322771d662f4513de"><td class="memItemLeft" align="right" valign="top"><a id="a2715f00996ee150322771d662f4513de" name="a2715f00996ee150322771d662f4513de"></a>
static constexpr int&#160;</td><td class="memItemRight" valign="bottom"><b>min</b> = 60 * <a class="el" href="#ad4d844ed6c8d5bb3f7f332001ea17544">second</a></td></tr>
<tr class="memdesc:a2715f00996ee150322771d662f4513de"><td class="mdescLeft">&#160;</td><td class="mdescRight">Constants value: min, expressed in milliseconds. <br /></td></tr>
<tr class="separator:a2715f00996ee150322771d662f4513de"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a04a50a6dbf5c3fdeefbdd7dfdb9a6ecc" id="r_a04a50a6dbf5c3fdeefbdd7dfdb9a6ecc"><td class="memItemLeft" align="right" valign="top"><a id="a04a50a6dbf5c3fdeefbdd7dfdb9a6ecc" name="a04a50a6dbf5c3fdeefbdd7dfdb9a6ecc"></a>
static constexpr int&#160;</td><td class="memItemRight" valign="bottom"><b>hour</b> = 60 * <a class="el" href="#a2715f00996ee150322771d662f4513de">min</a></td></tr>
<tr class="memdesc:a04a50a6dbf5c3fdeefbdd7dfdb9a6ecc"><td class="mdescLeft">&#160;</td><td class="mdescRight">Constants value: hour, expressed in milliseconds. <br /></td></tr>
<tr class="separator:a04a50a6dbf5c3fdeefbdd7dfdb9a6ecc"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3ad1b6141da3c1a9cab0737c6c227c9c" id="r_a3ad1b6141da3c1a9cab0737c6c227c9c"><td class="memItemLeft" align="right" valign="top"><a id="a3ad1b6141da3c1a9cab0737c6c227c9c" name="a3ad1b6141da3c1a9cab0737c6c227c9c"></a>
static constexpr int&#160;</td><td class="memItemRight" valign="bottom"><b>day</b> = 24 * <a class="el" href="#a04a50a6dbf5c3fdeefbdd7dfdb9a6ecc">hour</a></td></tr>
<tr class="memdesc:a3ad1b6141da3c1a9cab0737c6c227c9c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Constants value: day, expressed in milliseconds. <br /></td></tr>
<tr class="separator:a3ad1b6141da3c1a9cab0737c6c227c9c"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>A simple, feature-rich modern C++ date-time class. </p>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a id="ac6a75875790295481a05a136af4a2439" name="ac6a75875790295481a05a136af4a2439"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac6a75875790295481a05a136af4a2439">&#9670;&#160;</a></span>datetime() <span class="overload">[1/2]</span></h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">cutl::datetime::datetime </td>
          <td>(</td>
          <td class="paramtype">uint64_t</td>          <td class="paramname"><span class="paramname"><em>ms</em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Construct a new datetime object. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">ms</td><td>a timestamp in milliseconds for initialize the datetime object </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a9d1d9cc43a398a20909754ffa3de7366" name="a9d1d9cc43a398a20909754ffa3de7366"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a9d1d9cc43a398a20909754ffa3de7366">&#9670;&#160;</a></span>datetime() <span class="overload">[2/2]</span></h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">cutl::datetime::datetime </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="classcutl_1_1datetime.html">datetime</a> &amp;</td>          <td class="paramname"><span class="paramname"><em>other</em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Construct a new datetime object. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">other</td><td>other datetime object to copy </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a id="a1cc0a22792d1523874a647a3e336229f" name="a1cc0a22792d1523874a647a3e336229f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a1cc0a22792d1523874a647a3e336229f">&#9670;&#160;</a></span>format() <span class="overload">[1/2]</span></h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">std::string cutl::datetime::format </td>
          <td>(</td>
          <td class="paramtype">const std::string &amp;</td>          <td class="paramname"><span class="paramname"><em>fmt</em>, </span></td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool</td>          <td class="paramname"><span class="paramname"><em>local</em><span class="paramdefsep"> = </span><span class="paramdefval">true</span>, </span></td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool</td>          <td class="paramname"><span class="paramname"><em>show_milliseconds</em><span class="paramdefsep"> = </span><span class="paramdefval">true</span></span>&#160;) const</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Format the datetime object to a string with a custom format string. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">fmt</td><td>datetime format string, default is "%Y-%m-%d %H:%M:%S.%f". usages like std::put_time, reference to <a href="https://en.cppreference.com/w/cpp/io/manip/put_time">https://en.cppreference.com/w/cpp/io/manip/put_time</a> </td></tr>
    <tr><td class="paramname">local</td><td>whether to use local time, default is true. if true means output in local time, otherwise, output in UTC time. </td></tr>
    <tr><td class="paramname">show_milliseconds</td><td>whether to show milliseconds, default is true. if true means show milliseconds, otherwise, not show milliseconds. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>formatted datetime string described by std::string </dd></dl>

</div>
</div>
<a id="a3b652358d578694167f43d3dfe304e57" name="a3b652358d578694167f43d3dfe304e57"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a3b652358d578694167f43d3dfe304e57">&#9670;&#160;</a></span>format() <span class="overload">[2/2]</span></h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">std::string cutl::datetime::format </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="datetime_8h.html#a4e11bf4fcf504b16f185690443d143b4">datetime_format</a></td>          <td class="paramname"><span class="paramname"><em>dfmt</em><span class="paramdefsep"> = </span><span class="paramdefval"><a class="el" href="datetime_8h.html#a4e11bf4fcf504b16f185690443d143b4afc53fb608f9400b917e42c8c643be5a2">datetime_format::datetime_format_a</a></span>, </span></td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool</td>          <td class="paramname"><span class="paramname"><em>local</em><span class="paramdefsep"> = </span><span class="paramdefval">true</span>, </span></td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool</td>          <td class="paramname"><span class="paramname"><em>show_milliseconds</em><span class="paramdefsep"> = </span><span class="paramdefval">true</span></span>&#160;) const</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>format the datetime object to a string </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">dfmt</td><td>datetime format, a value of datetime_format enum, default is datetime_format_a </td></tr>
    <tr><td class="paramname">local</td><td>whether to use local time, default is true. if true means output in local time, otherwise, output in UTC time. </td></tr>
    <tr><td class="paramname">show_milliseconds</td><td>whether to show milliseconds, default is true. if true means show milliseconds, otherwise, not show milliseconds. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>formatted datetime string described by std::string </dd></dl>

</div>
</div>
<a id="add0aca89e3efa88a933113e181903be9" name="add0aca89e3efa88a933113e181903be9"></a>
<h2 class="memtitle"><span class="permalink"><a href="#add0aca89e3efa88a933113e181903be9">&#9670;&#160;</a></span>get()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static <a class="el" href="classcutl_1_1datetime.html">datetime</a> cutl::datetime::get </td>
          <td>(</td>
          <td class="paramtype">const std::string &amp;</td>          <td class="paramname"><span class="paramname"><em>time_text</em>, </span></td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int</td>          <td class="paramname"><span class="paramname"><em>isdst</em><span class="paramdefsep"> = </span><span class="paramdefval">-1</span></span>&#160;)</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Constructs a datetime object from a local time string. </p>
<p>Only the following time formats are supported:</p><ul>
<li>YYYY-MM-DD HH:MM:SS.sss</li>
<li>YYYY-MM-DD HH:MM:SS</li>
<li>YYYY.MM.DD HH:MM:SS.sss</li>
<li>YYYY.MM.DD HH:MM:SS</li>
<li>YYYY/MM/DD HH:MM:SS.sss</li>
<li>YYYY/MM/DD HH:MM:SS</li>
<li>YYYYMMDD HH:MM:SS.sss</li>
<li>YYYYMMDD HH:MM:SS <dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">time_text</td><td>local time string, use the below formats to construct a datetime object. </td></tr>
    <tr><td class="paramname">isdst</td><td>the setting of daylight saving time, -1 means system automatically determine, 0 means not in daylight saving time, 1 means in daylight saving time </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>datetime object constructed from the local time string </dd></dl>
</li>
</ul>

</div>
</div>
<a id="a2f26f17577618f7133b62b0343ecca0c" name="a2f26f17577618f7133b62b0343ecca0c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a2f26f17577618f7133b62b0343ecca0c">&#9670;&#160;</a></span>now()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static <a class="el" href="classcutl_1_1datetime.html">datetime</a> cutl::datetime::now </td>
          <td>(</td>
          <td class="paramname"><span class="paramname"></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Get a datetime object for the current system time. </p>
<dl class="section return"><dt>Returns</dt><dd>datetime object for the current system time </dd></dl>

</div>
</div>
<a id="a75282bebb7e0f1a9f359d8fc3cc98a3b" name="a75282bebb7e0f1a9f359d8fc3cc98a3b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a75282bebb7e0f1a9f359d8fc3cc98a3b">&#9670;&#160;</a></span>operator+()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classcutl_1_1datetime.html">datetime</a> cutl::datetime::operator+ </td>
          <td>(</td>
          <td class="paramtype">uint64_t</td>          <td class="paramname"><span class="paramname"><em>ms</em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Define the addition operator. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">ms</td><td>milliseconds to add </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>datetime object after adding milliseconds </dd></dl>

</div>
</div>
<a id="ad2fc579ef4a4b885b6c52b3bb8716022" name="ad2fc579ef4a4b885b6c52b3bb8716022"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad2fc579ef4a4b885b6c52b3bb8716022">&#9670;&#160;</a></span>operator+=()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classcutl_1_1datetime.html">datetime</a> &amp; cutl::datetime::operator+= </td>
          <td>(</td>
          <td class="paramtype">uint64_t</td>          <td class="paramname"><span class="paramname"><em>ms</em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Define the addition and assignment operator. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">ms</td><td>milliseconds to add </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>datetime&amp; the reference of the current datetime object after adding milliseconds </dd></dl>

</div>
</div>
<a id="af2de8f10337d6750870393076d1a02d3" name="af2de8f10337d6750870393076d1a02d3"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af2de8f10337d6750870393076d1a02d3">&#9670;&#160;</a></span>operator-() <span class="overload">[1/2]</span></h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int64_t cutl::datetime::operator- </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="classcutl_1_1datetime.html">datetime</a> &amp;</td>          <td class="paramname"><span class="paramname"><em>other</em></span></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Define the subtraction operator between two datetime objects. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">other</td><td>datetime object to subtract </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>the duration in milliseconds between current and other datetime objects </dd></dl>

</div>
</div>
<a id="ab4eb96ab29e504b7b9037338d2f9d0be" name="ab4eb96ab29e504b7b9037338d2f9d0be"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab4eb96ab29e504b7b9037338d2f9d0be">&#9670;&#160;</a></span>operator-() <span class="overload">[2/2]</span></h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classcutl_1_1datetime.html">datetime</a> cutl::datetime::operator- </td>
          <td>(</td>
          <td class="paramtype">uint64_t</td>          <td class="paramname"><span class="paramname"><em>ms</em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Define the subtraction operator. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">ms</td><td>milliseconds to subtract </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>datetime object after subtracting milliseconds </dd></dl>

</div>
</div>
<a id="a411c0ba1168f95601b8cc2e708959f23" name="a411c0ba1168f95601b8cc2e708959f23"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a411c0ba1168f95601b8cc2e708959f23">&#9670;&#160;</a></span>operator-=()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classcutl_1_1datetime.html">datetime</a> &amp; cutl::datetime::operator-= </td>
          <td>(</td>
          <td class="paramtype">uint64_t</td>          <td class="paramname"><span class="paramname"><em>ms</em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Define the subtraction and assignment operator. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">ms</td><td>milliseconds to subtract </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>datetime&amp; the reference of the current datetime object after subtracting milliseconds </dd></dl>

</div>
</div>
<a id="a894c09f6eb005ed597a1de2392cbf737" name="a894c09f6eb005ed597a1de2392cbf737"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a894c09f6eb005ed597a1de2392cbf737">&#9670;&#160;</a></span>operator=()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classcutl_1_1datetime.html">datetime</a> &amp; cutl::datetime::operator= </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="classcutl_1_1datetime.html">datetime</a> &amp;</td>          <td class="paramname"><span class="paramname"><em>other</em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Define the assignment operator. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">other</td><td>other datetime object to copy </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>datetime&amp; the reference of the current datetime object </dd></dl>

</div>
</div>
<a id="a51fa427db5c0c7da4b4af906a958fdf2" name="a51fa427db5c0c7da4b4af906a958fdf2"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a51fa427db5c0c7da4b4af906a958fdf2">&#9670;&#160;</a></span>timestamp()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint64_t cutl::datetime::timestamp </td>
          <td>(</td>
          <td class="paramname"><span class="paramname"></span></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Get the timestamp in milliseconds. </p>
<dl class="section return"><dt>Returns</dt><dd>the timestamp in milliseconds </dd></dl>

</div>
</div>
<a id="a3a0d03eb44d72d49e727d8bf6c6c6517" name="a3a0d03eb44d72d49e727d8bf6c6c6517"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a3a0d03eb44d72d49e727d8bf6c6c6517">&#9670;&#160;</a></span>utctime()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">std::string cutl::datetime::utctime </td>
          <td>(</td>
          <td class="paramname"><span class="paramname"></span></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Get the string of UTC time described by datetime object. </p>
<dl class="section return"><dt>Returns</dt><dd>the string of UTC time in format "YYYY-MM-DD HH:MM:SS.sss" </dd></dl>

</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li>src/common_util/<a class="el" href="datetime_8h_source.html">datetime.h</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.10.0
</small></address>
</body>
</html>
